<?php


include '../test_upload_pic.php';
session_start();
ob_start();
date_default_timezone_set('PRC');
//var_dump($_POST);exit;
$error='';
$title = $_POST['title'];
$content = $_POST['editor01'];


	//将内容插入到数据库中
	if(empty($error)){
		include '../config.php';
		$link=mysql_connect(HOST,DBUSER,DBPASS) or die('数据库连接失败');
		mysql_select_db(DBNAME,$link);
		mysql_set_charset('utf8');
		
		if(empty($error)){
			$sql= "INSERT INTO t_news (title,content)
			VALUES('".$title."','".$type."','".$content."')";
			$sql= "update t_news set  title='".$title."',
			content='".$content."' where id=".$_POST['id'];
			$result=mysql_query($sql);
		}
		mysql_close($link);
	}
	//错误跳转
	if(empty($error)){
		header('Location:newsList.php?tid='.$tid.'&title='.$title);
	}else{
		header('Location:newsAdd.php?error='.$error.'&title='.$title.'&begin='.$begin);
	}
	ob_end_flush();
	?>